﻿using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace UCTT.NF46.SingleTest
{
    public class Test1
    {
        public Test1()
        {

        }

        private void Method1()
        {
            var random = new Random(420);
            var items = Enumerable.Range(0,100).Select(x =>
            {
                var number = random.Next();
                //return new Wrapper(number,number.ToString());
                return number.CompareTo(0);
            }).ToList();

            Span<int> listAsSpan = CollectionsMarshal.AsSpan(items);
            ref var searchSpace = ref MemoryMarshal.GetReference(listAsSpan);
            for (int i = 0; i < listAsSpan.Length; i++)
            {
                var item = Unsafe.Add(ref searchSpace, i);
                Console.WriteLine(item);
            }
        }
    }
}